import Vue from 'vue'
/**
 * 用户登录方法
 * @param {object} parameter 参数 {account: '', password: '', captcha: '12345'}
 * @returns {*}
 */
export function login (parameter) {
  return Vue.axios({
    url: '/login',
    method: 'post',
    data: parameter
  })
}

export function getInfo () {
  return Vue.axios({
    url: '/user/info',
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function getCurrentUserNav (token) {
  return Vue.axios({
    url: '/user/nav',
    method: 'get'
  })
}

export function logout () {
  return Vue.axios({
    url: '/auth/logout',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}